package aidansmeaton.airport.structures;

import aidansmeaton.airport.database.DatabaseHelper;
import android.content.Context;
import android.database.Cursor;

public class Route {
	
	private DatabaseHelper db;
	
	private Airport from;
	private Airport to;
	
	public Route(Context context, String fromAirport, String fromCountry, String toAirport, String toCountry){
		
		db = DatabaseHelper.getInstance(context);
		
		Cursor cFrom = db.getAirport(fromAirport,fromCountry);
		if (cFrom.getCount() > 0){
			cFrom.moveToFirst();
			from = new Airport(cFrom);
		}
		
		Cursor cTo = db.getAirport(toAirport,toCountry);
		if (cTo.getCount() > 0){
			cTo.moveToFirst();
			to = new Airport(cTo);
		}
		
	}
	
	public void setFrom(Airport from) {
		this.from = from;
	}
	public Airport getFrom() {
		return from;
	}
	public void setTo(Airport to) {
		this.to = to;
	}
	public Airport getTo() {
		return to;
	}

}
